/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package TableModel;

import Entities.Servis;
import java.util.ArrayList;
import java.util.List;
import javax.swing.table.AbstractTableModel;

/**
 *
 * @author Adrian
 */
public class Servis_TableModel extends AbstractTableModel {

    private List<Servis> servises = new ArrayList<Servis>();

    public Servis_TableModel(List<Servis> servises) {
        this.servises = servises;
    }

    public int getRowCount() {
        return servises.size();
    }

    public int getColumnCount() {
        return 5;
    }

    public Object getValueAt(int rowIndex, int columnIndex) {
        Servis servis = servises.get(rowIndex);
        switch (columnIndex) {
            case 0:
                return servis.getKode_servis();
            case 1:
                return servis.getTanggal_servis();
            case 2:
                return servis.getStatus_oli();
            case 3:
                return servis.getCatatan_servis();
            case 4:
                return servis.getBiaya_servis();
            default:
                return "";
        }
    }

    @Override
    public String getColumnName(int coloumn) {
        switch (coloumn) {
            case 0:
                return "Kode Servis";
            case 1:
                return "Tanggal Servis";
            case 2:
                return "Status Oli";
            case 3:
                return "Catatan Servis";
            case 4:
                return "Biaya Servis";
            default:
                return "";
        }
    }
}
